package priv.yiyuan.example.design.device;

/**
 * 灯
 * <p>
 * 桥接模式(具体实现者)
 *
 * @author YiYuan
 * @data 2025/8/19
 * @apoNote
 */
public class Light implements Device {

    private String location;

    private int brightness;

    public Light(String location) {
        this.location = location;
        this.brightness = 0;
    }

    @Override
    public void turnOn() {
        System.out.println(location + " 开灯.");
        brightness = 100;
    }

    @Override
    public void turnOff() {
        System.out.println(location + " 关灯.");
        brightness = 0;
    }

    @Override
    public void adjust(int brightness) {
        this.brightness = brightness;
        System.out.println(location + " 调节灯的亮度为 " + brightness + "%.");
    }
}
